<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<!--  var inorderTraversal = function (root) {
        return inorder(root);
    };

    function inorder(root) {
        let arr = [];
        if (!root) {
            return;
        }
        inorder(root.left);
        arr.push(root.val);
        inorder(root.right)
        return arr;
    } -->
<script>
    let res;
    var inorderTraversal = function (root) {
        res = [];
        if (root) {
            inorder(root);
        }
        return res;

    }

    function inorder(root) {
        if (!root) {
            return;
        }
        inorder(root.left);
        res.push(root.val);
        inorder(root.right)
    }
</script>

</html>